#include <iostream>
#include <string>
using namespace std;

//构造顺序：先构造其他类对象，再构造本类对象   其它类的对象作为本类的成员时 ，先构造其他类对象，再构造本类对象
// 析构顺序：先析构本类对象，再析构其他类对象

class Phone {
public:
    Phone (string name) : m_Pname(name) {
        cout << "Phone的构造函数调用" << endl;
    }
    ~Phone() {
        cout << "Phone的析构函数调用" << endl;
    }
    string m_Pname;
};
class Person {
public:

    Person (string name , string phone) : m_name(name) , m_phone(phone) {
        cout << "Person的构造函数调用" << endl;
    }
    ~Person() {
        cout << "Person的析构函数调用" << endl;
    }

    void show() {
        cout << "姓名：" << m_name << " 手机：" << m_phone.m_Pname << endl;
    }

    string m_name;
    Phone m_phone;
};

void test01() {
    Person p("张三" , "oppo");
    p.show();
}

int main() {
    test01();
    return 0;
}